<#import "../template.ftl" as t/>
<@t.html ; part>
    <#if part="head">
        <link href="<@spring.url "/resources/plugins/datatables/dataTables.bootstrap.css"/>" rel="stylesheet">
        <link href="<@spring.url "/resources/plugins/datatables/responsive.dataTables.min.css"/>" rel="stylesheet">
    </#if>
    <#if part="body">
        <div class="panel">
            <div class="panel-body">
                <table id="dt-basic" class="table table-striped table-bordered"
                       cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th class="hidden-xs">序号</th>
                        <th>公司名称</th>
                        <th class="hidden-xs">电压等级(kV)</th>
                        <th class="min-tablet hidden-xs">预估年电量(万kWh)</th>
                        <th class="min-tablet hidden-xs">合同执行日期</th>
                        <th class="min-tablet hidden-xs">合同年限</th>
                        <th class="min-desktop hidden-xs">客户地区</th>
                        <th class="min-desktop hidden-xs">绑定微信</th>
                        <th class="min-desktop">签约模式</th>
                        <th class="min-desktop">状态</th>
                    </tr>
                    </thead>
                    <tbody>
            <#if pageData.content?? && (pageData.content?size>0)>
                <#list pageData.content as data>
                    <tr>
                        <td class="hidden-xs">${data_index+1}</td>
                        <td>${(data.name)!}</td>
                        <td class="hidden-xs">${(data.detailInfo.voltageStep)!}</td>
                        <td class="hidden-xs">${(data.detailInfo.elecConsumption)!}</td>
                        <td class="hidden-xs"><#if (data.contractInfo.startAt)??>${(data.contractInfo.startAt?string("yyyy-MM-dd"))!}</#if></td>
                        <td class="hidden-xs">${(data.contractInfo.tradeCycle)!}</td>
                        <td class="hidden-xs">${(data.cityParent.name)!} ${(data.city.name)!}</td>
                        <td class="hidden-xs">${(data.wxNum)!}</td>
                        <td>
                            <#if (data.contractInfo)??>
                            <#if data.contractInfo.planType == 1>1:9分成
                            <#elseif data.contractInfo.planType == 2>全返
                            <#else>
                                <#if (data.contractSetting??)>
                                    <#if data.contractSetting.cooperationType == 1>
                                        ${(100-(data.contractSetting.longAgreementRate)!0)/10}:${((data.contractSetting.longAgreementRate)!0)/10}分成
                                    <#elseif data.contractSetting.cooperationType == 2>
                                        保底 ${(data.contractSetting.bottomPrice)!}
                                    <#elseif data.contractSetting.cooperationType == 4>
                                        ${(data.contractSetting.description)!}
                                    </#if>
                                </#if>
                            </#if>
                            </#if>
                        </td>
                        <td><#if data.status==1>未审核<#elseif data.status==2>已审核<#elseif data.status==3>审核未通过<#elseif data.status==4>已签约</#if></td>
                    </tr>
                </#list>
            </#if>
                    </tbody>
                </table>
            </div>
        </div>

    </#if>
    <#if part="modal">
    </#if>

    <#if part="foot_script">
        <script src="<@spring.url "/resources/plugins/datatables/jquery.dataTables.js"/>"></script>
        <script src="<@spring.url "/resources/plugins/datatables/dataTables.bootstrap.js"/>"></script>
        <script src="<@spring.url "/resources/plugins/datatables/dataTables.responsive.min.js"/>"></script>
        <script src="<@spring.url "/resources/js/tables-datatables.js"/>"></script>
        <script type="text/javascript">
            $('#dt-basic').dataTable( {
                "aLengthMenu": [[10, 25, 50, 100, -1], ["10", "25", "50", "100", "所有"]],
                <#if (userSetting.num3)??>
                "pageLength": ${userSetting.num3},
                </#if>
                "fnDrawCallback":function (settings) {
                    //$("#dt-basic thead tr th:first").removeClass("sorting_asc");
                    //$("#dt-basic tbody tr td:first").removeClass("sorting_asc");

                }
            });

            $("select[name='dt-basic_length']").change(function () {
                var selectValue = $("select[name='dt-basic_length']").val();
                $.post('<@spring.url "/sale/companyInfo/updateUserSetting" />',
                        {selectValue3:selectValue},
                        function (data) {
                        });
            });

        </script>
    </#if>
</@t.html>